import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import "../FKWidget/"

FKWidget{
    id:clientWidget
    relativeHeight: 0.5
    relativeWidth: 0.5

    signal cancel
    signal chooseClient(var cName, var cPassword)
    signal genClient(var cName, var cPassword, var cValidator)

    FKViewport{
        Column{
            anchors{
                top:parent.top
                left:parent.left
                right:parent.right
                margins:10
            }
            spacing: 5
            Item{
                width:parent.width
                height:clientName.height
                Text{
                    id:clientNameLbl
                    text: qsTr("Client name:")
                    height:parent.height
                    verticalAlignment: Qt.AlignVCenter
                    anchors{
                        top:parent.top
                        left:parent.left
                    }
                }
                TextField{
                    id:clientName
                    text:"pahaa"
                    anchors{
                        top:parent.top
                        left:clientNameLbl.right
                        right:parent.right
                        leftMargin: 5
                    }
                }
            }
            Item{
                width:parent.width
                height:clientName.height
                Text{
                    id:passwordLbl
                    text: qsTr("Password:")
                    height:parent.height
                    width:clientNameLbl.width
                    verticalAlignment: Qt.AlignVCenter
                    anchors{
                        top:parent.top
                        left:parent.left
                    }
                }
                TextField{
                    id:password
                    text:"gfhjkm"
                    anchors{
                        top:parent.top
                        left:passwordLbl.right
                        right:parent.right
                        leftMargin: 5
                    }
                }
            }
        }
        Column{
            anchors{
                bottom:parent.bottom
                left:parent.left
                right:parent.right
                margins:10
            }
            spacing: 5
            Button{
                text: qsTr("Log in")
                width:parent.width
                onClicked: clientWidget.chooseClient(clientName.text,password.text)
            }
            Button{
                text: qsTr("Registration")
                width:parent.width
                onClicked: clientWidget.genClient(clientName.text,password.text,null)
            }
            Button{
                text: qsTr("Back")
                width:parent.width
                onClicked: clientWidget.cancel()
            }
        }
    }
}
